package com.youbug.mall.order_oms.controller;


import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.youbug.common.vo.QueryVo;
import com.youbug.mall.order_oms.entity.OmsPaymentInfo;
import com.youbug.mall.order_oms.service.IOmsPaymentInfoService;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.springframework.web.bind.annotation.*;
import com.youbug.common.vo.R;
import org.springframework.beans.factory.annotation.Autowired;
import java.util.List;

import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 * 支付信息表 前端控制器
 * </p>
 *
 * @author youbug
 * @since 2024-07-20
 */
@RestController
@RequestMapping("/omsPaymentInfo")
public class OmsPaymentInfoController {
@Autowired
private IOmsPaymentInfoService omsPaymentInfoService;

    @PostMapping("/getOmsPaymentInfoPage")
    public R<IPage<OmsPaymentInfo>> getOmsPaymentInfoPage(@RequestBody QueryVo<OmsPaymentInfo> queryVo){

        IPage<OmsPaymentInfo> omsPaymentInfos = omsPaymentInfoService.getOmsPaymentInfoPage(queryVo);

        return R.ok(omsPaymentInfos);
    }

    @GetMapping("/getOmsPaymentInfoById/{id}")
    public R<OmsPaymentInfo> getOmsPaymentInfoById(@PathVariable Integer id){

        OmsPaymentInfo omsPaymentInfo = omsPaymentInfoService.getById(id);

        return R.ok(omsPaymentInfo);
    }

    @PostMapping("/add")
    public R<Boolean> add(@RequestBody OmsPaymentInfo omsPaymentInfo){

        boolean save = omsPaymentInfoService.save(omsPaymentInfo);

        return  R.ok(save);
    }

    @PostMapping("/update")
    public R<Boolean> update(@RequestBody OmsPaymentInfo omsPaymentInfo){

        boolean update = omsPaymentInfoService.updateById(omsPaymentInfo);

        return  R.ok(update);
    }

    @GetMapping("/delete/{id}")
    public R<Boolean> delete(@PathVariable Integer id){

        boolean remove = omsPaymentInfoService.removeById(id);

        return  R.ok(remove);
    }
}

